/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.edu.ecnu.gis.client.ltapi.localsearch;

/**
 *
 * @author meflyup
 */
public class LTLocalSearchRequest {

    static int id = 0;

    static public void search(String searchCondition, String city, LTLocalSearchRequestHandle handler) {
        createCallbackFunction(handler, searchCondition, city);
    }

    private native static void createCallbackFunction(LTLocalSearchRequestHandle obj, String searchCondition, String city)/*-{
    var search=new $wnd.LTLocalSearch(getResult);
    search.setCity(city);
    search.search(searchCondition);
    function getResult(searchResult){
    if(searchResult.count>0)  {
   // obj.@cn.edu.ecnu.gis.client.gadgets.FiveOneMapsGadget::onRequestComplete(Ljava/lang/String;)(searchResult.toJSONString())   ;                                                                                                            
    obj.@cn.edu.ecnu.gis.client.gadgets.FiveOneMapsGadget::onRequestComplete(Ljava/lang/String;)(searchResult.toJSONString())   ;                                                                                                            
     }  else{
    obj.@cn.edu.ecnu.gis.client.gadgets.FiveOneMapsGadget::onRequestFailed(Ljava/lang/String;)(searchResult.toJSONString())   ;                                                                                             
    }
     }
    }-*/;
}
